package com.kcsoft.mapper;

import com.kcsoft.pojo.Assistant;
import com.kcsoft.pojo.Sessions;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ChatMapper {

    @Insert("insert into dxai.session (session, create_user, create_time, name, assistant_id, type) values" +
            " (#{sessionId},#{userId}, now(),#{chatName}, #{assistantId}, #{type})")
    void saveSession(String sessionId, String chatName, Integer userId, String assistantId, String type);

    @Delete("delete from dxai.session where session = #{sessionId}")
    void deleteSession(String sessionId);

    @Select("select * from dxai.session where session = #{sessionId}")
    Sessions findBySession(String sessionId);

    @Select("select * from dxai.assistant where value >= #{role}")
    List<Assistant> list(Integer role);

}
